//
//  BaseTabbarViewController.m
//  ZJControlsClass
//
//  Created by apple on 2024/10/22.
//

#import "BaseTabbarViewController.h"

#import "HomeViewController.h"
#import "ApproveViewController.h"
#import "ProduceViewController.h"
#import "MessageViewController.h"
#import "MineViewController.h"
#import "ViewController.h"


#import "BaseNavgationViewController.h"
#import "BaseTabbar.h"



@interface BaseTabbarViewController ()<UITabBarControllerDelegate>

@end

@implementation BaseTabbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.delegate = self;
    [self addChildViewController];
}


-(void)addChildViewController{

    HomeViewController *home = [[HomeViewController alloc] init];
    ApproveViewController *Approve = [[ApproveViewController alloc] init];
    ProduceViewController *Produce = [[ProduceViewController alloc] init];
    MessageViewController *Message = [[MessageViewController alloc] init];
    MineViewController *mine = [[MineViewController alloc] init];

//    BaseNavgationViewController *nav1 = [[BaseNavgationViewController alloc] initWithRootViewController:home];
    home.tabBarItem.title = @"首页";
    home.tabBarItem.image = [UIImage imageNamed:@"首页1"];
    home.tabBarItem.selectedImage = [[UIImage imageNamed:@"首页2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    [self addChildViewController:home];

//    BaseNavgationViewController *nav2 = [[BaseNavgationViewController alloc] initWithRootViewController:Approve];
    Approve.tabBarItem.title = @"审批";
    Approve.tabBarItem.image = [[UIImage imageNamed:@"审批1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    Approve.tabBarItem.selectedImage = [[UIImage imageNamed:@"审批2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    [self addChildViewController:Approve];

//    BaseNavgationViewController *nav3 = [[BaseNavgationViewController alloc] initWithRootViewController:Produce];
    Produce.tabBarItem.title = @"示证";
    Produce.tabBarItem.image = [[UIImage imageNamed:@"示证1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    Produce.tabBarItem.selectedImage = [[UIImage imageNamed:@"示证2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [self addChildViewController:Produce];
    
//    BaseNavgationViewController *nav4 = [[BaseNavgationViewController alloc] initWithRootViewController:Message];
    Message.tabBarItem.title = @"消息";
    Message.tabBarItem.image = [[UIImage imageNamed:@"消息1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    Message.tabBarItem.selectedImage = [[UIImage imageNamed:@"消息2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [self addChildViewController:Message];

//    BaseNavgationViewController *nav5 = [[BaseNavgationViewController alloc] initWithRootViewController:mine];
    mine.tabBarItem.title = @"我的";
    mine.tabBarItem.image = [[UIImage imageNamed:@"我的1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    mine.tabBarItem.selectedImage = [[UIImage imageNamed:@"我的2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    [self addChildViewController:mine];

    //tabbar字体颜色
    [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName:FONT14,NSForegroundColorAttributeName:COLOR_RGB(180, 180, 180)} forState:UIControlStateNormal];
    [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName:FONT14,NSForegroundColorAttributeName:COLOR_RGB(50, 113, 237)} forState:UIControlStateSelected];

    //背景色
    [[UITabBar appearance] setBarTintColor:[UIColor whiteColor]];
    [UITabBar appearance].translucent = NO;
    //隐藏分割线
    [[UITabBar appearance] setBackgroundImage:[UIImage new]];
    [[UITabBar appearance] setShadowImage:[UIImage new]];



}


@end
